package Main;
import Book.BookList;
import User.NormalUser;
import User.AdminUser;
import User.User;

import java.util.Scanner;

public class Main {
    public static User login() {
        System.out.println("请输入姓名");
        Scanner in = new Scanner(System.in);
        String name = in.nextLine();
        System.out.println("1，管理员   2，用户");
        System.out.println("请输入想要操作的系统");
        int input = in.nextInt();
        if(input == 1) {
            return new AdminUser(name);
        }else if(input == 2) {
            return new NormalUser(name);
        }else {
            System.out.println("非法输入");
            return null;
        }
    }
    public static void main(String[] args) {
        BookList bookList = new BookList();
        User user = login();

        while(true) {
            if(user == null) {
                break;
            }
            int choose = user.menu();
            user.doWork(choose,bookList);
        }
    }
}
